<% for column in Supplier.content_columns %>
<p>
  <b><%= column.human_name %>:</b> <%=h @supplier.send(column.name) %>
</p>
<% end %>

<h2>Available materials</h2>

<table>
  <tr>
  <% for column in Material.content_columns %>
    <th><%= column.human_name %></th>
  <% end %>
    <th colspan=3>Action</th>
  </tr>
  
<% for material in @supplier.materials %>
  <tr>
  <% for column in Material.content_columns %>
    <td><%=h material.send(column.name) %></td>
  <% end %>
    <td><%= link_to 'Show', :controller => 'materials', :action => 'show', :supplier => @supplier, :id => material %></td>
    <td><%= link_to 'Edit', :controller => 'materials', :action => 'edit', :supplier => @supplier, :id => material %></td>
    <td><%= link_to 'Destroy', { :controller => 'materials', :action => 'destroy', :supplier => @supplier, :id => material }, :confirm => 'Are you sure?', :method => :post %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New material', :controller => 'materials', :supplier => @supplier, :action => 'new' %>

<hr/>

<%= link_to 'Edit', :action => 'edit', :id => @supplier %> |
<%= link_to 'Back', :action => 'list' %>
